package baltazar;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;

public class ContentEmployees extends ContentArea {
    
    private ImageIcon redIcon = new ImageIcon("./images/red.png");
    
    private JButton addNew = new JButton("Dodaj  ", redIcon);
    private JButton edit = new JButton("Edytuj  ", redIcon);
    private JButton delete = new JButton("Usuń  ", redIcon);
	
	private JPanel topPanel = new JPanel();
	private ListArea listArea = new ListArea();
	private SearchBar searchBar = new SearchBar();
    
	
    public ContentEmployees() {
		super();
        content.setLayout(new BorderLayout());
		topPanel.setLayout(new BorderLayout());
		
		JTextField fn = searchBar.getFirstNameSearchField();
		
		listArea.updateFilter(fn);
		
		
		topPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 0, 15));
		listArea.setBorder(BorderFactory.createEmptyBorder(15, 5, 15, 15));
		topPanel.add(searchBar, BorderLayout.CENTER);
		setBackground(new Color(250, 250, 198));
		topPanel.setBackground(new Color(250, 250, 198));
		searchBar.setBackground(new Color(250, 250, 198));
		listArea.setBackground(new Color(250, 250, 198));
		content.add(topPanel, BorderLayout.NORTH);
		content.add(listArea, BorderLayout.CENTER);
        createMenu();
    }
	
    
    private void createMenu() {
		for(int i=0; i<1; i++ ) {
		        sideMenu.add(new JLabel(" "));
            }
            
        addNew.setBackground(new Color(250, 250, 198));
        addNew.setHorizontalTextPosition(SwingConstants.LEFT);
		addNew.setHorizontalAlignment(SwingConstants.RIGHT);
		addNew.setBorderPainted(false);
        addNew.setFocusable(false);
        sideMenu.add(addNew);
            
		edit.setBackground(new Color(250, 250, 198));
		edit.setHorizontalTextPosition(SwingConstants.LEFT);
		edit.setHorizontalAlignment(SwingConstants.RIGHT);
		edit.setBorderPainted(false);
		edit.setFocusable(false);
        sideMenu.add(edit);
		  
		delete.setBackground(new Color(250, 250, 198));
		delete.setHorizontalTextPosition(SwingConstants.LEFT);
		delete.setHorizontalAlignment(SwingConstants.RIGHT);
		delete.setBorderPainted(false);
		delete.setFocusable(false);
		sideMenu.add(delete);          
    }
	
}
